import { View } from "../../../mvc/core/View";
import { IPetHirePanel } from "./IPetHirePanel";
import { DataProvider } from "../../../../fl/data/DataProvider";
import { Language } from "../../../../extend/language/Language";
import { GTextFormat } from "../../../common/GTextFormat";
import { FontUtil } from "../../../common/font/FontUtil";
import { ObjCreate } from "../common/ObjCreate";
import { TilePanel } from "../equipment/TilePanel";
import { PetHireMyRenderer } from "./PetHireMyRenderer";
type int = number;
//class PetHireMyPanel
    
    export  class PetHireMyPanel extends View implements IPetHirePanel
    {
        constructor()
        {
            super();
            this._dp = new DataProvider();
            this._tip = Language.getString(54366);
            this.init();
            return;
        }

        /* internal  */init(): void
        {
            var loc1=new GTextFormat(FontUtil.songtiName, 14, 15788607);
            ObjCreate.createTextField(Language.getString(54367), 0, 0, 220, 30, this, loc1);
            this._numTxt = ObjCreate.createTextField("0/3", 100, 0, 220, 30, this, loc1);
            this._hireList = new TilePanel();
            this._hireList.setStyle("cellRenderer", PetHireMyRenderer);
            this._hireList.columnWidth = 590;
            this._hireList.rowHeight = 95;
            this._hireList.setSize(595, 285);
            this._hireList.move(0, 30);
            this.addChild(this._hireList);
            this._tipTxt = ObjCreate.createTextField("", 0, 145, 600, 50, this, new GTextFormat(FontUtil.songtiName, 16, 15788607));
            this._tipTxt.visible = false;
            this._tipTxt.multiline = true;
            this._tipTxt.autoSize = flash.text.TextFieldAutoSize.CENTER;
            this._tipTxt.htmlText = "<textFormat leading=\'5\'>" + this._tip + "</textFormat>";
            return;
        }

        public updateDataProvider(arg1: Array<any>, arg2: int, arg3: int=1): void
        {
            if (arg1.length > 0) 
            {
                this._dp.removeAll();
                this._dp.addItem(arg1[0]);
                this._hireList.dataProvider = this._dp;
                this._tipTxt.visible = false;
            }
            else 
            {
                this._hireList.dataProvider.removeAll();
                this._tipTxt.visible = true;
            }
            return;
        }

        public updateHireCount(arg1: int): void
        {
            this._numTxt.text = arg1 + "/3";
            return;
        }

        /* internal */ /* var */_numTxt: Object /* flash.text.TextField */;

        /* internal */ /* var */_hireList: TilePanel;

        /* internal */ /* var */_dp: DataProvider;

        /* internal */ /* var */_tipTxt: Object /* flash.text.TextField */;

        /* internal */ /* var */_tip: string;
    }
